#ifndef COMMON_H
#define COMMON_H

#include <mira.h>
#include <stdio.h>

#define UDP_PORT 456
#define PAN_ID_COMMON 0x8724a685
#define KEY_LENGTH 16
extern const uint8_t KEY_COMMON[KEY_LENGTH];

enum device_type{ UNKNOWN_DEVICE=-1,GATEWAY, LATCH, ALARM, MOTION_SENSOR, ALARM_AND_MOTION_SENSOR, NETWORK_EXTENDER};
enum message_type{ UNKNOWN_MESSAGE=-1, SET_LATCH, RELEASE_LATCH, START_ALARM, STOP_ALARM, DISABLE_ALARM, ENABLE_ALARM, MOTION_DETECTED, IR_DETECTED }; 

#define ALERT           MIRA_GPIO_PIN(1,10)
#define LIS2DH_INT1     MIRA_GPIO_PIN(1,06)
#define LIS2DH_CS       MIRA_GPIO_PIN(0,29)
#define LIS2DH_MISO     MIRA_GPIO_PIN(0,08)
#define ALERT_BATT      MIRA_GPIO_PIN(0,24)
#define LIS2DH_MOSI     MIRA_GPIO_PIN(1,02)
#define LIS2DH_SCK      MIRA_GPIO_PIN(1,01)
#define ALARM_ENABLE    MIRA_GPIO_PIN(1,05)
#define ALARM_PWM       MIRA_GPIO_PIN(0,20) //Going to 1,11
#define LED_RED         MIRA_GPIO_PIN(1,07)
#define LED_BLUE        MIRA_GPIO_PIN(0,21)
#define LED_GREEN       MIRA_GPIO_PIN(0,12)
#define I2C_SDA         MIRA_GPIO_PIN(0,26)
#define I2C_SCL         MIRA_GPIO_PIN(0,27)

#endif
